package com.zkh.myutils.utils;

import com.zkh.myutils.io.log.Logger;

/**
 * 系统工具
 * @author zkh
 */
public class SystemUtils {
	
	/**
	 * 输出当前所有线程
	 */
	public static void showThread(){
		//获取当前线程组
		ThreadGroup currentGroup =  Thread.currentThread().getThreadGroup();
		//获取活跃线程的数量
		int activeCount = currentGroup.activeCount();
		//创建线程数组
		Thread[] threads = new Thread[activeCount];
		//将活跃线程放入线程数组
		currentGroup.enumerate(threads);
		//输出个数
		Logger.info("当前系统存在线程数量："+threads.length);
		//遍历线程数组
		for (int i = 0; i < activeCount; i++){
			Logger.info("线程号：" + i + " = " + threads[i].getName());
		}
	}
}
